package com.haima.sage.bigdata.api.frame.condition.expression;

import com.haima.sage.bigdata.api.frame.condition.OperatorType;
import com.haima.sage.bigdata.api.frame.condition.expression.impl.*;


public class LogicServiceFactory {


	public static LogicService getInstance(OperatorType logic, Object param) {
		if (logic != null) {
			if (OperatorType.Empty == logic) {
				return new EmptyLogicService(param);
			} else if (OperatorType.NotEmpty == logic) {
				return new NotEmptyLogicService(param);
			}  else if (OperatorType.Eq == logic) {
				return new EqualsLogicService(param);
			} else if (OperatorType.Gt == logic) {
				return new GtLogicService(param);
			} else if (OperatorType.Ge == logic) {
				return new GeLogicService(param);
			} else if (OperatorType.Lt == logic) {
				return new LtLogicService(param);
			} else if (OperatorType.Le == logic) {
				return new LeLogicService(param);
			} else if (OperatorType.Ne == logic) {
				return new NeLogicService(param);
			} else if (OperatorType.Contains == logic) {
				return new ContainsLogicService(param);
			} else if (OperatorType.NotContains == logic) {
				return new NotContainsLogicService(param);
			} else if (OperatorType.EqIgnoreCase == logic) {
				return new EqualsIgnoreCaseLogicService(param);
			} else if (OperatorType.StartWith == logic) {
				return new StartWithLogicService(param);
			} else if (OperatorType.EndWith == logic) {
				return new EndWithLogicService(param);
			} else if (OperatorType.Regex == logic) {
				return new RegexLogicService(param);
			}
		}
		return new NoneLogicService(param);
	}
}
